package com.woniuxy.controller;

import com.woniuxy.entity.dto.CarDTO;
import com.woniuxy.entity.dto.ReceivableOrderDTO;
import com.woniuxy.service.ReceivableOrderService;
import com.woniuxy.util.PageData;
import com.woniuxy.util.ResponseData;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/receivable")
public class ReceivableOrderController {
    @Resource
    private ReceivableOrderService receivableOrderService;


    @PostMapping("/queryAll")
    public ResponseData<?> queryAllCar(@RequestBody PageData<ReceivableOrderDTO> pageData) {
        return receivableOrderService.queryAll(pageData);
    }

    @GetMapping("/jiesuan/{id}")
    public ResponseData<?> jiesuan(@PathVariable("id") String id) {
        return receivableOrderService.updateSettlementStatus(id);
    }

    @PostMapping("/addDuiZhang")
    public ResponseData<?> addDuiZhang(@RequestBody ReceivableOrderDTO receivableOrderDTO) {
        return receivableOrderService.addDuiZhang(receivableOrderDTO);
    }


    @PostMapping("/queryAll2")
    public ResponseData<?> queryAll2(@RequestBody PageData<ReceivableOrderDTO> pageData) {
        return receivableOrderService.queryAll2(pageData);
    }
}
